import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm'

/**
 * 项目实体
 */
@Entity('projects')
export class Project {
  @PrimaryGeneratedColumn('uuid')
  id: string = ''

  @Column({ length: 100, type: 'varchar' })
  name: string = ''

  @Column({ type: 'text', nullable: true })
  description: string = ''

  @CreateDateColumn({ type: 'datetime' })
  createdAt: Date = new Date()

  @UpdateDateColumn({ type: 'datetime' })
  updatedAt: Date = new Date()

  @Column({ type: 'datetime', nullable: true })
  lastOpenedAt: Date = new Date()

  @Column({ type: 'int', default: 0 })
  duration: number = 0

  @Column({ type: 'text', nullable: true })
  thumbnail: string = ''

  @Column({ type: 'simple-json' })
  resolution: { width: number; height: number } = { width: 1280, height: 720 }

  @Column({ type: 'int', default: 30 })
  frameRate: number = 30

  @Column({ type: 'text', nullable: true })
  filePath: string = ''

  @Column({ type: 'simple-json', nullable: true })
  metadata: any = {}

  constructor(partial?: Partial<Project>) {
    if (partial) {
      Object.assign(this, partial)
    }
  }
} 